package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import dto.MerchantDto;
import dto.ResponseDto;
import pojo.MerchantApplication;
import service.MerchantApplicationManager;
import service.factory.ManagerFactory;
import util.JsonUtil;

public class LoadWaitAuditServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private MerchantApplicationManager manager = null;
    private Logger logger = LogManager.getLogger(LoadWaitAuditServlet.class);   

    public LoadWaitAuditServlet() {
        super();
        manager = ManagerFactory.getApplicationManagerInstance();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String flag = request.getParameter("flag");
		List<MerchantApplication> merchants = manager.getByStatus(MerchantApplication.WAIT_AUDIT);
		if(flag != null)
			request.setAttribute("flag", flag);
		request.setAttribute("merchants", merchants);
		request.getRequestDispatcher("../../merchantWait.jsp").forward(request, response);
	}
}
